//
//  CCMeshCube.cpp
//  ShadowMapping
//
//  Created by Daniel Corleone on 5/6/14.
//  Copyright (c) 2014年 iCloverStudio. All rights reserved.
//

#include "CCMeshCube.h"
#include "PlatformFeatures.h"

BECO_NAMESPACE_BEGIN

Cube::Cube(Real width, Real height, Real depth)
: Mesh("")
{
    width  /= 2.0;
    height /= 2.0;
    depth  /= 2.0;
    
    Real vertices[] = {
        -width, -height, -depth, // 0
        width, -height, -depth, // 1
        width,  height, -depth, // 2
        -width,  height, -depth, // 3
        -width, -height,  depth, // 4
        width, -height,  depth, // 5
        width,  height,  depth, // 6
        -width,  height,  depth, // 7
    };
    
	Int32 indices[] = {
        5, 4, 0,
        1, 5, 0,
        6, 5, 1,
        2, 6, 1,
        7, 6, 2,
        3, 7, 2,
        4, 7, 3,
        0, 4, 3,
        6, 7, 4,
        5, 6, 4,
        1, 0, 3,
        2, 1, 3,
    };
    
	Mesh::setIndices(indices, sizeof(indices) / sizeof(Int32));
    Mesh::setVertices(vertices, sizeof(vertices) / sizeof(Real));
}

BECO_NAMESPACE_END
